#!/bin/bash
if [ $# -lt 1 ]; then
  echo "Fills zeros to a number to make it a string of a fixed length"
  echo "Usage: $0 <number> [<positions, default 2]"
  echo "makes a string of 'positions' length"
  exit -1
fi
if [ $# -ge 2 ]; then
  len=$2
else
  len=2
fi
echo $1 $len|awk '{fmt="%0"$2"ld";  printf(fmt , $1)}'
